home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Format 1994 October
/
Macformat17.cdr
/
Shareware City
/
Developers
/
GAL ƒ
/
GAL examples
/
power
< prev
next >
Wrap
Text File
|
1994-07-11
|
352b
|
23 lines
; calculates a^b
; where a is in R0=> b in R1 and the answer in R0
copy a=>Reg0
copy b=>reg1
jump:subroutine power
halt
noop
power
copy reg0=>reg2 ;save the value
copy 1=>reg0
looptop
compare 0=>reg1
jump:greater_equal endit
multiply reg2=>reg0 ;
subtract 1=>reg1
jump:always looptop
endit
return
noop
a constant 5
b constant 4
end